﻿@model USERS.CYT369.COM.MODELS.Articles.Document
@using USERS.CYT369.COM.Models
@{
    Layout = "_Layout";
    ViewData["Title"] = "发布文章";
}
@section styles{
    <link href="~/css/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" />
    <link href="~/lib/jquery-easyui-1.10.0/themes/metro/easyui.css" rel="stylesheet" />
    <link href="~/lib/jquery-easyui-1.10.0/themes/color.css" rel="stylesheet" />
    <link href="~/lib/jquery-easyui-1.10.0/themes/icon.css" rel="stylesheet" />
    <link href="~/lib/ueditor1.4.3.3-utf8/themes/default/css/ueditor.min.css" rel="stylesheet" />
    <link href="~/lib/fileupload-9.18.0/jquery.fileupload.css" rel="stylesheet" />
    <link href="~/css/news/article-edit.css" rel="stylesheet" />
    <link href="~/css/site.css" rel="stylesheet" />
}
@section scripts{
    <script src="~/lib/jquery-easyui-1.10.0/jquery.easyui.min.js"></script>
    <script src="~/lib/jquery-easyui-1.10.0/locale/easyui-lang-zh_CN.js"></script>
    <script src="~/lib/ueditor1.4.3.3-utf8/news-ueditor.config.js"></script>
    <script src="~/lib/ueditor1.4.3.3-utf8/ueditor.all.min.js"></script>
    <script src="~/lib/fileupload-9.18.0/vendor/jquery.ui.widget.js"></script>
    <script src="~/lib/fileupload-9.18.0/load-image.all.min.js"></script>
    <script src="~/lib/fileupload-9.18.0/jquery.fileupload.js"></script>
    <script src="~/lib/fileupload-9.18.0/jquery.fileupload-process.js"></script>
    <script src="~/lib/fileupload-9.18.0/jquery.fileupload-image.js"></script>
    <script src="~/js/Common.js"></script>
    <script src="~/js/SystemSetting.js"></script>
    <script src="~/js/news/article-edit.js"></script>
}
<div class="easyui-layout layout" fit="true">
    <div data-options="region:'north'" class="toolbar-panel">
            <a href="~/News/ArticleIndex" class="btns back-button">返回</a>
            <a class="btns save-button" href="javascript:SaveArticle()">保存草稿</a>
            <a class="btns active-button" href="javascript:SubmitAuditPublish()">提交审核</a>
        <div id="editor-toolbar" class="toolbar"></div>
    </div>
    <div data-options="region:'west',split:false" class="left-panel">
        <div class="easyui-layout image-panel" data-options="fit:true,border:false">
            <div data-options="region:'north',border:false" style="height:50px;padding:10px;text-align:center">
                <span class="fileinput-button upload-btn">
                    <span>+上传图片</span>
                    <input type="file" multiple="multiple" id="_upload_img_btn" name="_upload_img_btn[]" />
                </span>
            </div>
            <div data-options="region:'center'" class="min-scrollbar" style="padding:10px">
                <form id="image-form">
                    <ul id="image-panel-list" class="image-list">
                        @if (Model != null)
                        {
                            foreach (var docFile in Model.Attachments)
                            {
                                var fid = docFile.Id;

                                <li class="image-item">
                                    <img class="img" src="@string.Format("{0}/{1}", USERS.CYT369.COM.UTILITY.SystemSettingService.Instance.NewsInternalBucket.HttpURL, docFile.ImagePath)" />
                                    <div class="img-name">
                                        <div style="display:inline-block">
                                            <i class="fa fa-remove remove" title="删除" onclick="RemoveAttachment(this, @Model.Id, @fid)"></i>
                                            <div class="anme" title="@docFile.Name">@docFile.Name</div>
                                        </div>
                                    </div>
                                </li>
                            }
                        }
                    </ul>
                </form>
            </div>
        </div>
    </div>
    <div data-options="region:'center'" class="center-panel min-scrollbar">
        <form id="edit-article-form">
            <div class="attributes-panel">
                <div class="title-panel">
                    <input type="hidden" id="DocID" name="DocID" value="@(Model==null?0:Model.Id)" />
                    <input type="hidden" id="UserID" name="UserID" value="@ViewBag.UserID" />
                    <input type="text" id="DocTitle" name="DocTitle" class="title" placeholder="请输入文章标题（5-100个字）" value="@(Model==null?string.Empty:Model.Title)" />
                </div>
                <div class="attr-img">
                    <div class="attributes">
                        <div class="attr-row">
                            <div class="attr-cell name-cell">栏目分类：</div>
                            <div class="attr-cell value-cell">
                                <input class="easyui-combotree" name="DocumentTypeID" id="DocumentTypeID" style="width:350px"
                                       data-options="editable:false,textField:'text',valueField:'Id',url:'~/News/GetUserDocCategorys',method:'get'" />
                            </div>
                        </div>
                        <div class="attr-row">
                            <div class="attr-cell name-cell">创作类型：</div>
                            <div class="attr-cell value-cell">
                                <input class="easyui-radiobutton" name="ContentSourceID" value="1" label="原创" labelPosition="after">
                                <input class="easyui-radiobutton" name="ContentSourceID" value="2" label="转载" labelPosition="after">
                                <input class="easyui-radiobutton" name="ContentSourceID" value="3" label="翻译" labelPosition="after">
                            </div>
                        </div>
                        <div class="attr-row">
                            <div class="attr-cell name-cell">摘要：</div>
                            <div class="attr-cell value-cell">
                                <input id="Summary" name="Summary" class="easyui-textbox" data-options="prompt:'摘要（选填）：256个字符'" multiline="true" style="width:550px; height: 100px" value="@(Model==null?string.Empty:Model.Summary)" />
                            </div>
                        </div>
                        <div class="attr-row">
                            <div class="attr-cell name-cell">作者：</div>
                            <div class="attr-cell value-cell">
                                <input class="easyui-textbox" id="Author" name="Author" data-options="prompt:'请填写原文作者'" style="width:550px" value="@(Model==null?string.Empty:Model.Author)" />
                            </div>
                        </div>
                        <div class="attr-row">
                            <div class="attr-cell name-cell">原文来源：</div>
                            <div class="attr-cell value-cell">
                                <input class="easyui-textbox" id="TargetURL" name="TargetURL" data-options="prompt:'请填写来源或原文链接'" style="width:550px" value="@(Model==null?string.Empty:Model.TargetURL)" />
                            </div>
                        </div>
                    </div>
                    <div id="docPreviewImg" class="previewImg fileinput-button upload-btn">
                        @if (string.IsNullOrEmpty(Model.PreviewImg))
                        {
                            <span>+上传预览图</span>
                        }
                        else
                        {
                            <img class="img" src="@string.Format("{0}/{1}", USERS.CYT369.COM.UTILITY.SystemSettingService.Instance.NewsInternalBucket.HttpURL, Model.PreviewImg)" />
                        }
                        <input type="file" id="_upload_previewImg_btn" name="_upload_previewImg_btn[]" />
                    </div>
                </div>
            </div>
            <div class="container-panel">
                <div id="editor-text-area" class="container"></div>
            </div>
        </form>
    </div>
</div>